import { Module } from '@nestjs/common';
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';
import { AppController } from './app.controller';
import { AppService } from './app.service';

@Module({
  imports: [
    // 配置静态资源服务，让uploads目录可通过URL访问
    ServeStaticModule.forRoot({
      rootPath: join(__dirname, '..', 'uploads'), // 指向上传目录
      serveRoot: '/uploads', // 访问前缀，即通过 /uploads/文件名 访问
    }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
